<?php
/**
 *	KLF Framework
 *
 *	Written by Kristian Oye <kristianoye@gmail.com> on Dec 18, 2011
 *	Copyright (C) 2010-2011
 */
namespace KLF\System\Web\MVC
{
	use KLF\System\KObject;
	use KLF\System\Web\KHttpContext;
	use KLF\System\Web\Routing\KRouteData;
	use KLF\System\Web\Routing\KRouteContext;

	/**
	 *  Class KControllerContext
	 *
	 *  Context wrapper for use within a controller.
	 *
	 *  @package KLF\System\Web\MVC
	 *  @access public
	 *  @author Kristian Oye <kristianoye@gmail.com>
	 *  @since 0.1
	 *
	 *  @method KControllerContext NewInstance
	 *  
	 *  @property KController $Controller
	 *  @property string $ControllerName
	 *  @property KHttpContext $HttpContext
	 *  @property KRouteContext $RouteContext
	 *  @property KRouteData $RouteData
	 */
	class KControllerContext extends KRouteContext
	{
		/**
		 * 
		 * @var KController $_rpropController
		 */
		protected $_rpropController;
		
		/**
		 * 
		 * @var KHttpContext $_rpropHttpContext
		 */
		protected $_rpropHttpContext;
		
		/**
		 * Returns the name of the controller.
		 * 
		 * @var string $_rpropControllerName
		 */
		protected $_rpropControllerName;
		
		/**
		 * 
		 * @var KRouteContext $_rpropRouteContext
		 */
		protected $_rpropRouteContext;
		
		/**
		 * 
		 * @var KRouteData $_rpropRouteData
		 */
		protected $_rpropRouteData;
		
		/**
		 * Construct a new KController context object.
		 * 
		 * @param KRouteContext $context
		 * @param KController $controller
		 */
		public function __construct(KRouteContext $context, $controllerName = '', $controller=null)
		{
			parent::__construct($context->HttpContext, $context->RouteData, $context->RouteCollection);
			
			$this->_rpropController = $controller;
			$this->_rpropControllerName = $controllerName;
			$this->_rpropHttpContext = $context->HttpContext;
			$this->_rpropRouteContext = $context;
			$this->_rpropRouteData = $context->RouteData;
		}
	}
}